package com.liliya.service.impl;

import com.liliya.dao.EmpDao;
import com.liliya.dao.impl.EmpDaoImpl;
import com.liliya.pojo.Emp;
import com.liliya.service.EmpService;

import java.util.List;

/**
 * @Description TODO
 * @Author hhy
 * @Date 2021/1/5 11:32
 */
public class EmpServiceImpl implements EmpService {
    private EmpDao empDao = new EmpDaoImpl();


    @Override
    public List<Emp> findEmps(Integer start, Integer end) {
        return empDao.findEmps(start, end);
    }

    @Override
    public Integer findEmpCount() {
        return empDao.findEmpCount();
    }

    @Override
    public Integer findPageCount(Integer step) {
        int pageCount = 0;
        int totalPage = empDao.findEmpCount(); //先查一共有多少条记录
        pageCount = totalPage % step == 0 ? totalPage / step : totalPage / step + 1;
        return pageCount;
    }
}
